package com.tengju.support.domain.model.rule;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum ActionType {

    DATA_TIME_HINT(1,"数据更新时间提示文案","com.tengju.support.domain.model.rule.DataTimeHintAction"),
    INVITE_HINT(2,"邀约时间提示文案","com.tengju.support.domain.model.rule.InviteHintAction"),
    INVITE_HINT_CAL_PASS_TIME(3,"邀约时间提示文案(计算已过天数)","com.tengju.support.domain.model.rule.InviteHintCalPassTimeAction"),

    ;

    private Integer val;
    private String desc;
    private String classPath;

    @JsonValue
    public Integer getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public String getClassPath() {
        return classPath;
    }

    @JsonCreator
    public static ActionType fromVal(Integer val) {
        for (ActionType type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }

}
